import React from 'react';
import {Router,Route,hashHistory,IndexRoute,IndexRedirect} from 'react-router';

//共享导航
import ScrollMenu from '../components/commons/ScrollMenu';

import AppView from './AppView';
import IndexView from './IndexView';
import CrowdFunding from './crowdFunding';// 众筹
import AboutUs from './about';// 关于美人谷
import Loading from './loading';// 加载模块


import Index from '../components/index'; // 首页
  //index children
  // import Community from '../components/community';// 俪社
  import Order from '../components/order';// 定制
  // import TransfromView from '../components/transformView';// 蜕变
    // import art_det from '../components/transform_them/art_det';// 推荐



import UserView from './userView';// 个人中心
  import user from '../components/user';//主页
  import Login from '../components/user_them/login';//主页
  import Problems from '../components/user_them/problems';// 常见问题
  import Agreement from '../components/user_them/agreement';//用户协议
  // import Setting from '../components/user_them/setting';//主页
  // import Shop_car from '../components/user_them/shop_car'; //购物车
  import Confirm_order from '../components/user_them/confirm_order';//确认订单
  import Pay from '../components/user_them/pay'; //支付
    import Pay_suc from '../components/user_them/pay_status'; //支付结果状态

  import UserOrderView from './orderView';
    import UserOrderClassify from '../components/user_them/order/classify';//订单分类界面
    import allOrders from '../components/user_them/order/all';//全部订单
    import pendingOrders from '../components/user_them/order/pending';//订单分类界面
    import unconsumedOrders from '../components/user_them/order/unconsumed';//订单分类界面
    import consumedOrders from '../components/user_them/order/consumed';//订单分类界面
    import refundOrders from '../components/user_them/order/refund';//订单分类界面
    import OrderDetail from '../components/user_them/order/detail';//订单分类界面


  import ApplyRefund from '../components/user_them/applyRefund'; //退款申请
    import ApplyRefundStatus from '../components/user_them/applyRefundStatus';//退款申请结果状态

import MallView from './mallView';// 甄选
  //Mall children
  import Mall_them_meif from '../components/mall_them/Mall_them_meif'; // 美服
  import Mall_them_weiz from '../components/mall_them/Mall_them_weiz'; //微整
  import Mall_them_doc from '../components/mall_them/Mall_them_doc';// 医生列表
  import Mall_them_hos from '../components/mall_them/Mall_them_hos';//医院列表
  import Doc_det from '../components/mall_them/doc_det'; // 医生详情
  import Hos_det from '../components/mall_them/hos_det'; // 医院详情
  import Pro_list from '../components/mall_them/pro_list'; // 商品列表
  // import Brand_zone from '../components/mall_them/brand_zone'; // 品牌专区
  import Serv_det from '../components/mall_them/serv_det'; // 服务详情

  import {syncHistoryWithStore} from 'react-router-redux';

  import configureStore from '../stores';
  const store = configureStore();
  const history = syncHistoryWithStore(hashHistory, store)


const App = () =>(
        <div>
        <Router history={history}>

          <Route path='/crowdFunding' component={CrowdFunding} />
          {/* mall -> children */}
          <Route path='/doc/det/:id' component={Doc_det} />
          <Route path='/hos/det/:id' component={Hos_det} />
          <Route path='/pro/list/:id' component={Pro_list} />
          <Route path='/servItem/det/:id' component={Serv_det} />
          {/* <Route path='/art/detial/:id' component={art_det} /> */}

          {/* user -> chilrem */}
          {/* <Route path="/user/shop_car" component={Shop_car} /> */}
          <Route path="/user/problems" component={Problems} />
          <Route path="/user/agreement" component={Agreement} />
          {/* <Route path="/user/setting" component={Setting} /> */}
          <Route path="/user/confirm_order/:itemId" component={Confirm_order} />
          <Route path="/user/pay/:id" component={Pay} />
          <Route path="/user/payStatus/:unionSN" component={Pay_suc} />
          <Route path="/user/applyRefund/:unionSN" component={ApplyRefund} />
          <Route path="/user/applyRefundStatus/:itemPrice" component={ApplyRefundStatus} />
          <Route path="/user/order/detail/:unionSN" component={OrderDetail} />

          {/* user -> orderView */}
          <Route path="/user/orderView" component={UserOrderView}>
            {/* <IndexRedirect to='/user/orderView/:path' /> */}
            <Route path="/user/orderView/all" component={allOrders} />
            <Route path="/user/orderView/pending" component={pendingOrders} />
            <Route path="/user/orderView/unconsumed" component={unconsumedOrders} />
            <Route path="/user/orderView/consumed" component={consumedOrders} />
            <Route path="/user/orderView/refund" component={refundOrders} />

          </Route>

          <Route path="/" component={AppView}>
            <IndexRedirect to='/indexView' />

            <Route path='indexView' component={IndexView} >
              <IndexRedirect to='to_index' />
              <Route path='to_index' component={Index}>
                <IndexRedirect to='order' />
                <Route path="them_weiz" component={Mall_them_weiz} />
                <Route path="them_meif" component={Mall_them_meif} />
                <Route path="them_doc" component={Mall_them_doc} />
                <Route path="them_hos" component={Mall_them_hos} />
                <Route path='order' component={Order} />
              </Route>
              {/* <Route path='community' component={Community} /> */}
              {/* <Route path='order' component={Order} /> */}
              {/* 蜕变 */}
              {/* <Route path='transformView' component={TransfromView} /> */}

            </Route>

            {/* 甄选mall */}
            <Route path="mallView" component={MallView} >
              <IndexRedirect to='them_weiz' />
              <Route path="them_weiz" component={Mall_them_weiz} />
              <Route path="them_meif" component={Mall_them_meif} />
              <Route path="them_doc" component={Mall_them_doc} />
              <Route path="them_hos" component={Mall_them_hos} />
            </Route>
            {/* mall -> 品牌专区 */}
            {/* <Route path="mall/brand_zone" component={Brand_zone} /> */}

            {/* <Route path="crowdFunding" component={CrowdFunding} /> */}
            <Route path="about" component={AboutUs} />

            {/* 用户中心 */}
            <Route path="userView/user" component={UserView} >
              {/* <IndexRedirect to={this.props.user_logined?"user":"login"} />*/}
              {/* <Route path="login" component={Login} /> */}
            </Route>
          </Route>
          {/* ↑ AppView end */}
        </Router>
        <Loading />
        </div>
    )

export default App
// export default connect(mapStateToProps)(App)
